<template>
    <div>
        <el-card>
            <h1>这里是子组件</h1>
            <el-form-item label="父组件的值">
                <el-alert :title="msg" />
            </el-form-item>
            <el-form-item label="子组件的值">
                <el-input v-model="msgFromChild" />
            </el-form-item>
            <hr>

            <el-button type="primary" @click="$emit('childChick','来自子组件的值')">子组件的点击</el-button>
            <el-button  @click="sendMsg">发送Child页面的消息到ToDo组件</el-button>
        </el-card>
    </div>
</template>
<script>
import {ref} from 'vue'
import bus from 'vue3-eventbus'
export default{
    name:'Event',
    props:{
        msg:String
    },
    setup(){
        const msgFromChild=ref("我是子组件的值")
        const sendMsg=function(){
            bus.emit('getMsg',msgFromChild.value)
        }
        return{
            msgFromChild,
            sendMsg
        }
    }
}
</script>
<style>

</style>